<template>
	<view class="main">
		<view class="active_tit">
			<view class="tit">
				资产明细
			</view> 
		</view>
		<view class="active_tit">
			<view class="tit2">
				应收账款、其他应收款
			</view> 
		</view>
		<view v-for="(item,index) in stdOffsurAssetLiability.collaterals.receiveAccount" :key="index+'q1'">
			<view class="cut">应收账款、其他应收款{{index+1}} <uni-icons class="clear" type="clear" @click='stdDel(stdOffsurAssetLiability.collaterals.receiveAccount,item,"stdOffsurAssetLiability")'></uni-icons></view>
			<view class="main">
				<ActiveForm   ref=''>
					<view class="active_label">
						序号：
					</view>
					<view class="active_input">
						<input type="text" :disabled="true" v-model="item.xh" />
					</view>
				</ActiveForm>
				<ActiveForm required  ref=''>
					<view class="active_label">
						债务人：
					</view>
					<view class="active_input">
						<input type="text" v-model="item.debtUsername" />
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						发生日期：
					</view>
					<view class="active_input">
						<picker style="width: 100%;" mode="date" :value="item.occurTime"   @change="(o)=>{item.occurTime=o.target.value}">
						    <view >{{item.occurTime}}</view>
						</picker>
					</view>
				</ActiveForm>
				<ActiveForm required  ref=''>
					<view class="active_label">
						账龄（月）：
					</view>
					<view class="active_input">
						<input type="text" v-model="item.accountAge" />
					</view>
				</ActiveForm>
				<ActiveForm required  ref=''>
					<view class="active_label">
						预计回收时间：
					</view>
					<view class="active_input">
						<picker style="width: 100%;" mode="date" :value="item.receiveTimePlan"   @change="(o)=>{item.receiveTimePlan=o.target.value}">
						    <view >{{item.receiveTimePlan}}</view>
						</picker>
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						金额（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="item.receiveAtm" />
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
                        结算方式
					</view>
					<view class="active_input">
						<input type="text" v-model="item.settlementType" />
					</view>
				</ActiveForm>
				<ActiveForm   ref=''>
					<view class="active_label">
				        备注
					</view>
					<view class="active_input">
						<input type="text" v-model="item.remark" />
					</view>
				</ActiveForm>
			</view>
		</view>
		<view class="active_tit">
			<view class="" style="display: flex;">
				<view class="add" @click="add1">
					新增应收账款、其他应收款
				</view>
			</view>
		</view>
		
		<view class="active_tit">
			<view class="tit2">
				预付账款
			</view> 
		</view>
		<view v-for="(item,index) in stdOffsurAssetLiability.collaterals.prePayAccount" :key="index+'q2'">
			<view class="cut">预付账款{{index+1}} <uni-icons class="clear" type="clear" @click='stdDel(stdOffsurAssetLiability.collaterals.prePayAccount,item,"stdOffsurAssetLiability")'></uni-icons></view>
			<view class="main">
				<ActiveForm   ref=''>
					<view class="active_label">
						序号：
					</view>
					<view class="active_input">
						<input type="text" :disabled="true" v-model="item.xh" />
					</view>
				</ActiveForm>
				<ActiveForm required  ref=''>
					<view class="active_label">
						预付对象：
					</view>
					<view class="active_input">
						<input type="text" v-model="item.prePayObj" />
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						发生日期：
					</view>
					<view class="active_input">
						<picker style="width: 100%;" mode="date" :value="item.occurTime"   @change="(o)=>{item.occurTime=o.target.value}">
						    <view >{{item.occurTime}}</view>
						</picker>
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						预计到货时间：
					</view>
					<view class="active_input">
						<picker style="width: 100%;" mode="date" :value="item.prePayTimePlan"   @change="(o)=>{item.prePayTimePlan=o.target.value}">
						    <view >{{item.prePayTimePlan}}</view>
						</picker>
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						金额（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="item.prePayAtm" />
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
		                结算方式
					</view>
					<view class="active_input">
						<input type="text" v-model="item.settlementType" />
					</view>
				</ActiveForm>
				<ActiveForm   ref=''>
					<view class="active_label">
				        备注
					</view>
					<view class="active_input">
						<input type="text" v-model="item.remark" />
					</view>
				</ActiveForm>
			</view>
		</view>
		<view class="active_tit">
			<view class="" style="display: flex;">
				<view class="add" @click="add2">
					新增预付账款
				</view>
			</view>
		</view>
		
		<view class="active_tit">
			<view class="tit2">
				存货、固定资产
			</view> 
		</view>
		<view v-for="(item,index) in stdOffsurAssetLiability.collaterals.stocks" :key="index+'q3'">
			<view class="cut">存货、固定资产{{index+1}} <uni-icons class="clear" type="clear" @click='stdDel(stdOffsurAssetLiability.collaterals.stocks,item,"stdOffsurAssetLiability")'></uni-icons></view>
			<view class="main">
				<ActiveForm   ref=''>
					<view class="active_label">
						序号：
					</view>
					<view class="active_input">
						<input type="text" :disabled="true" v-model="item.xh" />
					</view>
				</ActiveForm>
				<ActiveForm required  ref=''>
					<view class="active_label">
						名称：
					</view>
					<view class="active_input">
						<input type="text" v-model="item.stockName" />
					</view>
				</ActiveForm>
				
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						数量：
					</view>
					<view class="active_input">
						<input type="text" v-model="item.stockCount" />
					</view>
				</ActiveForm>
				
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						总价值（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="item.stockTotalAmount" />
					</view>
				</ActiveForm>
				<ActiveForm   ref=''>
					<view class="active_label">
				        备注
					</view>
					<view class="active_input">
						<input type="text" v-model="item.remark" />
					</view>
				</ActiveForm>
			</view>
		</view>
		<view class="active_tit">
			<view class="" style="display: flex;">
				<view class="add" @click="add3">
					新增存货、固定资产
				</view>
			</view>
		</view>
		
		<view class="active_tit">
			<view class="tit">
				负债明细
			</view> 
		</view>
		<view class="active_tit">
			<view class="tit2">
				应付账款、其他应付款
			</view> 
		</view>
		<view v-for="(item,index) in stdOffsurAssetLiability.debts.payAccount" :key="index+'q4'">
			<view class="cut">应付账款、其他应付款{{index+1}} <uni-icons class="clear" type="clear" @click='stdDel(stdOffsurAssetLiability.debts.payAccount,item,"stdOffsurAssetLiability")'></uni-icons></view>
			<view class="main">
				<ActiveForm   ref=''>
					<view class="active_label">
						序号：
					</view>
					<view class="active_input">
						<input type="text" :disabled="true" v-model="item.xh" />
					</view>
				</ActiveForm>
				<ActiveForm required  ref=''>
					<view class="active_label">
						债权人：
					</view>
					<view class="active_input">
						<input type="text" v-model="item.payUsername" />
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						发生日期：
					</view>
					<view class="active_input">
						<picker style="width: 100%;" mode="date" :value="item.occurTime"   @change="(o)=>{item.occurTime=o.target.value}">
						    <view >{{item.occurTime}}</view>
						</picker>
					</view>
				</ActiveForm>
				<ActiveForm required  ref=''>
					<view class="active_label">
						账龄（月）：
					</view>
					<view class="active_input">
						<input type="text" v-model="item.accountAge" />
					</view>
				</ActiveForm>
				<ActiveForm required  ref=''>
					<view class="active_label">
						预计付款时间：
					</view>
					<view class="active_input">
						<picker style="width: 100%;" mode="date" :value="item.payTimePlan"   @change="(o)=>{item.payTimePlan=o.target.value}">
						    <view >{{item.payTimePlan}}</view>
						</picker>
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						金额（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="item.payAtm" />
					</view>
				</ActiveForm>
				
				<ActiveForm required   ref=''>
					<view class="active_label">
		                结算方式
					</view>
					<view class="active_input">
						<input type="text" v-model="item.settlementType" />
					</view>
				</ActiveForm>
				<ActiveForm   ref=''>
					<view class="active_label">
				        备注
					</view>
					<view class="active_input">
						<input type="text" v-model="item.remark" />
					</view>
				</ActiveForm>
			</view>
		</view>
		<view class="active_tit">
			<view class="" style="display: flex;">
				<view class="add" @click="add4">
					新增应付账款、其他应付款
				</view>
			</view>
		</view>
		
		<view class="active_tit">
			<view class="tit2">
				预收账款
			</view> 
		</view>
		<view v-for="(item,index) in stdOffsurAssetLiability.debts.preGetAccount" :key="index+'q5'">
			<view class="cut">预收账款{{index+1}} <uni-icons class="clear" type="clear" @click='stdDel(stdOffsurAssetLiability.debts.preGetAccount,item,"stdOffsurAssetLiability")'></uni-icons></view>
			<view class="main">
				<ActiveForm   ref=''>
					<view class="active_label">
						序号：
					</view>
					<view class="active_input">
						<input type="text" :disabled="true" v-model="item.xh" />
					</view>
				</ActiveForm>
				<ActiveForm required  ref=''>
					<view class="active_label">
						预收对象：
					</view>
					<view class="active_input">
						<input type="text" v-model="item.prePayObj" />
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						收款日期：
					</view>
					<view class="active_input">
						<picker style="width: 100%;" mode="date" :value="item.preGetTimePlan"   @change="(o)=>{item.preGetTimePlan=o.target.value}">
						    <view >{{item.preGetTimePlan}}</view>
						</picker>
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						预计发货时间：
					</view>
					<view class="active_input">
						<picker style="width: 100%;" mode="date" :value="item.payTimePlan"   @change="(o)=>{item.payTimePlan=o.target.value}">
						    <view >{{item.payTimePlan}}</view>
						</picker>
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
						金额（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="item.preGetAtm" />
					</view>
				</ActiveForm>
				
				<ActiveForm required  ref=''>
					<view class="active_label">
		                结算方式
					</view>
					<view class="active_input">
						<input type="text" v-model="item.settlementType" />
					</view>
				</ActiveForm>
				<ActiveForm   ref=''>
					<view class="active_label">
				        备注
					</view>
					<view class="active_input">
						<input type="text" v-model="item.remark" />
					</view>
				</ActiveForm>
				
			</view>
		</view>
		<view class="active_tit">
			<view class="" style="display: flex;">
				<view class="add" @click="add5">
					新增预收账款
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import SelectPicker from "../../SelectPicker";
	import RegionPicker from "../../RegionPicker";
	import region from '../areaList.js'
	export default {
		name: 'userCars',
		data() {
			return {
				region,
				province: "",
				city: "",
				county: "",
				index: 1,
				listNum:1,
				stdOffsurAssetLiability:{
					collaterals:{
						receiveAccount:[],
						prePayAccount:[],
						stocks:[]
					},
					debts:{
						payAccount:[],
						preGetAccount:[]
					}
				},
			}
		},
		components: {
			SelectPicker,
			RegionPicker
		},
		watch:{
			stdOffsurAssetLiability:{
				handler:function(res){
					getApp().globalData.stdOffsurAssetLiability = res
				},
				deep:true
			},
		},
		mounted() {
			//获取返显数据
			setTimeout(()=>{
				if(!getApp().globalData.stdOffsurAssetLiability){
					this.stdOffsurAssetLiability={
						collaterals:{
							receiveAccount:[],
							prePayAccount:[],
							stocks:[]
						},
						debts:{
							payAccount:[],
							preGetAccount:[]
						}
					}
					
				}else{
					this.stdOffsurAssetLiability = getApp().globalData.stdOffsurAssetLiability
				}
				
				
			},getApp().globalData.timeout)
		},
		methods:{
			add1(){
				this.stdOffsurAssetLiability.collaterals.receiveAccount.push(
					{
						debtUsername:'',
						occurTime:'',
						accountAge:'',
						receiveTimePlan:'',
						receiveAtm:'',
						settlementType:'',
						xh: this.stdOffsurAssetLiability.collaterals.receiveAccount.length + 1
					}
				)
			},
			add2(){
				this.stdOffsurAssetLiability.collaterals.prePayAccount.push(
					{
						prePayObj:'',
						occurTime:'',
						prePayTimePlan:'',
						prePayAtm:'',
						settlementType:'',
						xh: this.stdOffsurAssetLiability.collaterals.prePayAccount.length + 1
					}
				)
			},
			add3(){
				this.stdOffsurAssetLiability.collaterals.stocks.push(
					{
						stockName:'',
						stockCount:'',
						stockTotalAmount:'',
						xh: this.stdOffsurAssetLiability.collaterals.stocks.length + 1
					}
				)
			},
			add4(){
				this.stdOffsurAssetLiability.debts.payAccount.push(
					{
						payUsername:'',
						occurTime:'',
						accountAge:'',
						payTimePlan:'',
						payAtm:'',
						settlementType:'',
						xh: this.stdOffsurAssetLiability.debts.payAccount.length + 1
					}
				)
			},
			add5(){
				this.stdOffsurAssetLiability.debts.preGetAccount.push(
					{
						prePayObj:'',
						occurTime:'',
						payTimePlan:'',
						preGetTimePlan:'',
						preGetAtm:'',
						settlementType:'',
						xh: this.stdOffsurAssetLiability.debts.preGetAccount.length + 1
					}
				)
			}
		}
	}
</script>

<style lang="scss">
	
	
</style>

